home *** CD-ROM | disk | FTP | other *** search
/ Champak 29 / Volume 29 - JOGO DISK .iso / Games / jungle_adventure.swf / scripts / __Packages / Spikes.as < prev    next >
Text File  |  2006-11-29  |  1KB  |  38 lines

  1. class Spikes extends SSObject
  2. {
  3.    var assetID = "spikes";
  4.    var soundID = "spikes";
  5.    var value = -0.2;
  6.    var classID = SSGlobal.CLSID_OBJECT;
  7.    var collisionMask = SSGlobal.CLSID_SHAPE;
  8.    var strength = 250;
  9.    var editor_isItem = true;
  10.    var editor_name = "Spikes";
  11.    var editor_canRotate = true;
  12.    var editor_args_names = ["value"];
  13.    var editor_args_values = [0];
  14.    var editor_args_types = ["number"];
  15.    var editor_args_options = [[-1,1,0.01]];
  16.    var editor_args_descriptions = [""];
  17.    var editor_args_mode = [0];
  18.    var editor_args_component = ["NumericStepper"];
  19.    function Spikes(value)
  20.    {
  21.       super();
  22.       if(value != null)
  23.       {
  24.          this.value = value;
  25.       }
  26.    }
  27.    function onCollision(obj)
  28.    {
  29.       var _loc2_ = undefined;
  30.       (_loc2_ = new Vector(obj.x >= this.x ? 1 : -1,-2,0)).normalize();
  31.       obj.velocity.x = _loc2_.x * this.strength;
  32.       obj.velocity.y = _loc2_.y * this.strength;
  33.       GameSound.playSound(this.soundID);
  34.       obj.shiftHealth(this.value,this);
  35.       return GDK.Node.COLLISION_CANCEL;
  36.    }
  37. }
  38.